package com.example.liwushuo.utils;

import android.content.Context;


import com.example.liwushuo.R;
import com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiskCache;
import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.ImageLoaderConfiguration;

/**
 * Created by Administrator on 2015/10/9.
 */
public class ImageLoaderUtil {
    /**
     * 全局图片加载框架 UIL
     */
    public static void configGolbalImageLoader(Context context){
        ImageLoaderConfiguration.Builder builder=new ImageLoaderConfiguration.Builder(context);
        builder.diskCache(new UnlimitedDiskCache(FileUtil.getImageCache()));
        ImageLoader.getInstance().init(builder.build());
    }
    public static DisplayImageOptions getDefaultOptions(){
        DisplayImageOptions options=new DisplayImageOptions.Builder()
                .showImageOnFail(R.mipmap.ic_launcher)
                .showImageOnLoading(R.mipmap.ic_launcher)
                .cacheInMemory(true)
                .cacheOnDisk(true).build();
        return options;

    }
}
